<?php
    session_start();
    include_once '../../../../controlador/php/conexion/Conexion.php';
    $con = new Conexion();
    
    $oid = $_REQUEST['oid'];
    $posi = $_REQUEST['posi'];
    
    $Existe = "select COUNT(*) as n from segtranslado where hcnsolexa = '".$oid."'";
    $res = $con ->query($Existe);
    
    while($res2 = mssql_fetch_array($res)){
        $n = $res2['n'];
    }
    
    if($n == 0){
        
        $insert = "insert into segtranslado(hcnsolexa,trfecha,trestado,usu_oid)values('".$oid."',GETDATE(),'1','".$_SESSION['usuario']."')";
        $con ->query($insert);
    }else{
        $update = "update segtranslado
                   set trfecha = GETDATE(),
                   trestado = '1',
                   usu_oid = '".$_SESSION['usuario']."'
                   where hcnsolexa = '".$oid."'";
        $con ->query($update);
    }
    $con->cerrarConexion();
    
 
?>